<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	$("#addrepositoryTitles").click(function(){
		var addid=document.getElementById('editrepository');
		$(addid).find("[name='id']").val('');
		$(addid).find("[name='pid']").val('');
		$(addid).find("[name='title']").val('');
		 dialog = art.dialog({
		        title: "新增清单标题",
		        lock:true,
		        content: addid
		    });
	});
})

function sosuo(){
	var lpath =location.pathname;
	var pageNo = $("#pageNo").val();
	$("#soform").attr("action",lpath);
	$("#soform").submit();
}

//删除一个
function delexcept(id){
	art.dialog.confirm("是否确认删除？",function(){
			art.dialog.post({
				url:"/repository/o_del_except.do",
				data:{id:id},
				success:function(data){
					if(data.success){
						art.dialog.alert("删除成功",function(){
							refresh();
						})
					}
				}
			},"正在删除");
	});
}



function sub(){
	var title=$("#editrepository").find("[name='title']").val();
	art.dialog.post({
		url : '/repository/o_add_except.do',
		data : {title : title},
		success : function(data){
			if(data.success){
				refresh();
			}else{
				art.dialog.tips(data.msg);
			}
		}
	},"正在提交...");
}
</script>
</head>
<body>
	<div class="panel panel-info">
		<div class="panel-heading"> 
			<table>
				<tr>
					<td>
						<button id="addrepositoryTitles"  type="button" class="btn btn-info "  >新增</button>
					</td>
				</tr>
			</table>
		</div>
		<table class="table table-hover table-bordered">
		
			<tr>
				<th width="5%">#</th>
				<th width="20%">清单标题</th>
				<th width="20%">清单类别</th>
				<th width="15%">创建时间</th>
				<th width="15%">修改时间</th>
				<th width="20%">操作</th>
			</tr>
 
			[#list pagination.list as repositoryTitles]
			<tr>
				<td>${pagination.pageSize * (pagination.pageNo-1)+repositoryTitles_index+1}</td>
				<td>${repositoryTitles.title!}</td>
				<td>[#if repositoryTitles.type==0]全部[#elseif repositoryTitles.type==1]询价[#elseif repositoryTitles.type==2]报价[/#if]</td>
				<td>${(repositoryTitles.createtime?string("yyyy-MM-dd"))!}</td>
				<td>${(repositoryTitles.updatetime?string("yyyy-MM-dd"))!}</td>
				<td>
					<input value="删除" type="button" onclick="delexcept(${repositoryTitles.id});" class="btn btn-danger btn-xs" />
				</td>
			</tr>
			[/#list]
		</table>
		
		<div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
	</div>
	
	<div id="editrepository" style="width: 500px;height:150px;display: none;">
		 <form id="repositoryfrom" action="o_editorAddTitle.do" method="post" class="form-horizontal" role="form">
		       <div class="form-group">
			      <label  class="col-sm-2 control-label">清单标题</label>
			      <div class="col-sm-8">
			         <input type="text" class="form-control"  
			            placeholder="请输入标题" min="1" maxlength="100" required="required" id="title" name="title">
			      </div>
		      </div>
		       <div class="form-group">
				      <label  class="col-sm-2 control-label">清单类别</label>
				      <div class="col-sm-8">
				      <select class="form-control" required="required" id="type" name="type">
				      <option value="0">全部</option>
				      <option value="1">询价</option>
				      <option value="2">报价</option>
				      </select>
				      </div>
			     </div>
   				<div class="form-group" style="margin-top: 10px;">
				      <div class="col-sm-offset-2 col-sm-8">
				         <button  type="button" onclick="sub()" class="btn btn-default">提交</button>
				      </div>
   				</div>
		 </form>
	</div>
</body>
</html>